package com.bd08.flink.demo.zhang

import org.apache.flink.api.scala.{ExecutionEnvironment, createTypeInformation}

object ReduceDemo extends App {
  val env = ExecutionEnvironment.getExecutionEnvironment
  val ds  = env.fromCollection(List("a","b","c","d","a","b"))
  ds.reduce(_+_).print()
  ds.map((_,1)).groupBy(0).reduce((x,y)=>(x._1,x._2+y._2)).print()

}
